module klang.编译.triple.Triple;
import 全局;
import klang.编译.核心.核心_: 整数_, 开始包含, 结尾包含, 查找索引, 是数字类的, 创建词典从关联数组, 词典_, 分割, 替换, 连接, 分割文本, 分割结果_, 创建数组, 查找字符索引;
import klang.编译.类型.枚举值.枚举值_: 字符_;
import klang.编译.系统.系统_: sys;
klang.编译.triple.Triple.ARCHNames!(klang.编译.triple.Triple.ARM_ArchKind)[37] ARM_ARCHNames;
klang.编译.triple.Triple.ARM_ArchKind[dstring] ARM_ArchKindObj;
词典_!(klang.编译.triple.Triple.ARM_ArchKind) _平台种类词典;
static this() {
    ARM_ArchKindObj = [
        "invalid"d : ARM_ArchKind.INVALID,
        "armv2"d : ARM_ArchKind.ARMV2,
        "armv2a"d : ARM_ArchKind.ARMV2A,
        "armv3"d : ARM_ArchKind.ARMV3,
        "armv3m"d : ARM_ArchKind.ARMV3M,
        "armv4"d : ARM_ArchKind.ARMV4,
        "armv4t"d : ARM_ArchKind.ARMV4T,
        "armv5t"d : ARM_ArchKind.ARMV5T,
        "armv5te"d : ARM_ArchKind.ARMV5TE,
        "armv5tej"d : ARM_ArchKind.ARMV5TEJ,
        "armv6"d : ARM_ArchKind.ARMV6,
        "armv6k"d : ARM_ArchKind.ARMV6K,
        "armv6t2"d : ARM_ArchKind.ARMV6T2,
        "armv6kz"d : ARM_ArchKind.ARMV6KZ,
        "armv6-m"d : ARM_ArchKind.ARMV6M,
        "armv7-a"d : ARM_ArchKind.ARMV7A,
        "armv7ve"d : ARM_ArchKind.ARMV7VE,
        "armv7-r"d : ARM_ArchKind.ARMV7R,
        "armv7-m"d : ARM_ArchKind.ARMV7M,
        "armv7e-m"d : ARM_ArchKind.ARMV7EM,
        "armv8-a"d : ARM_ArchKind.ARMV8A,
        "armv8.1-a"d : ARM_ArchKind.ARMV8_1A,
        "armv8.2-a"d : ARM_ArchKind.ARMV8_2A,
        "armv8.3-a"d : ARM_ArchKind.ARMV8_3A,
        "armv8.4-a"d : ARM_ArchKind.ARMV8_4A,
        "armv8.5-a"d : ARM_ArchKind.ARMV8_5A,
        "armv8.6-a"d : ARM_ArchKind.ARMV8_6A,
        "armv8.7-a"d : ARM_ArchKind.ARMV8_7A,
        "armv8-r"d : ARM_ArchKind.ARMV8R,
        "armv8-m.base"d : ARM_ArchKind.ARMV8MBaseline,
        "armv8-m.main"d : ARM_ArchKind.ARMV8MMainline,
        "armv8.1-m.main"d : ARM_ArchKind.ARMV8_1MMainline,
        "iwmmxt"d : ARM_ArchKind.IWMMXT,
        "iwmmxt2"d : ARM_ArchKind.IWMMXT2,
        "xscale"d : ARM_ArchKind.XSCALE,
        "armv7s"d : ARM_ArchKind.ARMV7S,
        "armv7k"d : ARM_ArchKind.ARMV7K
    ];
    _平台种类词典 = 创建词典从关联数组!(klang.编译.triple.Triple.ARM_ArchKind)(.ARM_ArchKindObj);
}
static this() {
    ARCHNames!(ARM_ArchKind) a = .ARM_ARCH("invalid"d, ARM_ArchKind.INVALID, ""d, ""d, ARMBuildAttrs_CPUArch.Pre_v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv2"d, ARM_ArchKind.ARMV2, "2"d, "v2"d, ARMBuildAttrs_CPUArch.Pre_v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv2a"d, ARM_ArchKind.ARMV2A, "2A"d, "v2a"d, ARMBuildAttrs_CPUArch.Pre_v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv3"d, ARM_ArchKind.ARMV3, "3"d, "v3"d, ARMBuildAttrs_CPUArch.Pre_v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv3m"d, ARM_ArchKind.ARMV3M, "3M"d, "v3m"d, ARMBuildAttrs_CPUArch.Pre_v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv4"d, ARM_ArchKind.ARMV4, "4"d, "v4"d, ARMBuildAttrs_CPUArch.v4, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv4t"d, ARM_ArchKind.ARMV4T, "4T"d, "v4t"d, ARMBuildAttrs_CPUArch.v4T, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv5t"d, ARM_ArchKind.ARMV5T, "5T"d, "v5"d, ARMBuildAttrs_CPUArch.v5T, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv5te"d, ARM_ArchKind.ARMV5TE, "5TE"d, "v5e"d, ARMBuildAttrs_CPUArch.v5TE, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv5tej"d, ARM_ArchKind.ARMV5TEJ, "5TEJ"d, "v5e"d, ARMBuildAttrs_CPUArch.v5TEJ, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv6"d, ARM_ArchKind.ARMV6, "6"d, "v6"d, ARMBuildAttrs_CPUArch.v6, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv6k"d, ARM_ArchKind.ARMV6K, "6K"d, "v6k"d, ARMBuildAttrs_CPUArch.v6K, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv6t2"d, ARM_ArchKind.ARMV6T2, "6T2"d, "v6t2"d, ARMBuildAttrs_CPUArch.v6T2, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv6kz"d, ARM_ArchKind.ARMV6KZ, "6KZ"d, "v6kz"d, ARMBuildAttrs_CPUArch.v6KZ, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_DSP));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv6-m"d, ARM_ArchKind.ARMV6M, "6-M"d, "v6m"d, ARMBuildAttrs_CPUArch.v6_M, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7-a"d, ARM_ArchKind.ARMV7A, "7-A"d, "v7"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7ve"d, ARM_ArchKind.ARMV7VE, "7VE"d, "v7ve"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7-r"d, ARM_ArchKind.ARMV7R, "7-R"d, "v7r"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, (ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7-m"d, ARM_ArchKind.ARMV7M, "7-M"d, "v7m"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, ArchExtKind.AEK_HWDIVTHUMB);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7e-m"d, ARM_ArchKind.ARMV7EM, "7E-M"d, "v7em"d, ARMBuildAttrs_CPUArch.v7E_M, FeatureKind.FK_NONE, (ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8-a"d, ARM_ArchKind.ARMV8A, "8-A"d, "v8"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.1-a"d, ARM_ArchKind.ARMV8_1A, "8.1-A"d, "v8.1a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.2-a"d, ARM_ArchKind.ARMV8_2A, "8.2-A"d, "v8.2a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.3-a"d, ARM_ArchKind.ARMV8_3A, "8.3-A"d, "v8.3a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.4-a"d, ARM_ArchKind.ARMV8_4A, "8.4-A"d, "v8.4a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS | ArchExtKind.AEK_DOTPROD));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.5-a"d, ARM_ArchKind.ARMV8_5A, "8.5-A"d, "v8.5a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS | ArchExtKind.AEK_DOTPROD));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.6-a"d, ARM_ArchKind.ARMV8_6A, "8.6-A"d, "v8.6a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS | ArchExtKind.AEK_DOTPROD | ArchExtKind.AEK_BF16 | ArchExtKind.AEK_I8MM));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.7-a"d, ARM_ArchKind.ARMV8_7A, "8.7-A"d, "v8.7a"d, ARMBuildAttrs_CPUArch.v8_A, FeatureKind.FK_NONE, (ArchExtKind.AEK_SEC | ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC | ArchExtKind.AEK_RAS | ArchExtKind.AEK_DOTPROD | ArchExtKind.AEK_BF16 | ArchExtKind.AEK_I8MM));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8-r"d, ARM_ArchKind.ARMV8R, "8-R"d, "v8r"d, ARMBuildAttrs_CPUArch.v8_R, FeatureKind.FK_NONE, (ArchExtKind.AEK_MP | ArchExtKind.AEK_VIRT | ArchExtKind.AEK_HWDIVARM | ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_DSP | ArchExtKind.AEK_CRC));
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8-m.base"d, ARM_ArchKind.ARMV8MBaseline, "8-M.Baseline"d, "v8m.base"d, ARMBuildAttrs_CPUArch.v8_M_Base, FeatureKind.FK_NONE, ArchExtKind.AEK_HWDIVTHUMB);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8-m.main"d, ARM_ArchKind.ARMV8MMainline, "8-M.Mainline"d, "v8m.main"d, ARMBuildAttrs_CPUArch.v8_M_Main, FeatureKind.FK_NONE, ArchExtKind.AEK_HWDIVTHUMB);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv8.1-m.main"d, ARM_ArchKind.ARMV8_1MMainline, "8.1-M.Mainline"d, "v8.1m.main"d, ARMBuildAttrs_CPUArch.v8_1_M_Main, FeatureKind.FK_NONE, ArchExtKind.AEK_HWDIVTHUMB | ArchExtKind.AEK_RAS | ArchExtKind.AEK_LOB);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("iwmmxt"d, ARM_ArchKind.IWMMXT, "iwmmxt"d, ""d, ARMBuildAttrs_CPUArch.v5TE, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("iwmmxt2"d, ARM_ArchKind.IWMMXT2, "iwmmxt2"d, ""d, ARMBuildAttrs_CPUArch.v5TE, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("xscale"d, ARM_ArchKind.XSCALE, "xscale"d, "v5e"d, ARMBuildAttrs_CPUArch.v5TE, FeatureKind.FK_NONE, ArchExtKind.AEK_NONE);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7s"d, ARM_ArchKind.ARMV7S, "7-S"d, "v7s"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
    a = .ARM_ARCH("armv7k"d, ARM_ArchKind.ARMV7K, "7-K"d, "v7k"d, ARMBuildAttrs_CPUArch.v7, FeatureKind.FK_NONE, ArchExtKind.AEK_DSP);
    ARM_ARCHNames[(cast(uint)(a.ID))] = a;
}
enum ArchType : int {
    UnknownArch = 0,
    arm = 1,
    armeb = 2,
    aarch64 = 3,
    aarch64_be = 4,
    aarch64_32 = 5,
    arc = 6,
    avr = 7,
    bpfel = 8,
    bpfeb = 9,
    csky = 10,
    hexagon = 11,
    m68k = 12,
    mips = 13,
    mipsel = 14,
    mips64 = 15,
    mips64el = 16,
    msp430 = 17,
    ppc = 18,
    ppcle = 19,
    ppc64 = 20,
    ppc64le = 21,
    r600 = 22,
    amdgcn = 23,
    riscv32 = 24,
    riscv64 = 25,
    sparc = 26,
    sparcv9 = 27,
    sparcel = 28,
    systemz = 29,
    tce = 30,
    tcele = 31,
    thumb = 32,
    thumbeb = 33,
    x86 = 34,
    x86_64 = 35,
    xcore = 36,
    nvptx = 37,
    nvptx64 = 38,
    le32 = 39,
    le64 = 40,
    amdil = 41,
    amdil64 = 42,
    hsail = 43,
    hsail64 = 44,
    spir = 45,
    spir64 = 46,
    spirv32 = 47,
    spirv64 = 48,
    kalimba = 49,
    shave = 50,
    lanai = 51,
    wasm32 = 52,
    wasm64 = 53,
    renderscript32 = 54,
    renderscript64 = 55,
    ve = 56,
    LastArchType = 56
}
enum SubArchType : int {
    NoSubArch = 0,
    ARMSubArch_v8_7a = 1,
    ARMSubArch_v8_6a = 2,
    ARMSubArch_v8_5a = 3,
    ARMSubArch_v8_4a = 4,
    ARMSubArch_v8_3a = 5,
    ARMSubArch_v8_2a = 6,
    ARMSubArch_v8_1a = 7,
    ARMSubArch_v8 = 8,
    ARMSubArch_v8r = 9,
    ARMSubArch_v8m_baseline = 10,
    ARMSubArch_v8m_mainline = 11,
    ARMSubArch_v8_1m_mainline = 12,
    ARMSubArch_v7 = 13,
    ARMSubArch_v7em = 14,
    ARMSubArch_v7m = 15,
    ARMSubArch_v7s = 16,
    ARMSubArch_v7k = 17,
    ARMSubArch_v7ve = 18,
    ARMSubArch_v6 = 19,
    ARMSubArch_v6m = 20,
    ARMSubArch_v6k = 21,
    ARMSubArch_v6t2 = 22,
    ARMSubArch_v5 = 23,
    ARMSubArch_v5te = 24,
    ARMSubArch_v4t = 25,
    AArch64SubArch_arm64e = 26,
    KalimbaSubArch_v3 = 27,
    KalimbaSubArch_v4 = 28,
    KalimbaSubArch_v5 = 29,
    MipsSubArch_r6 = 30,
    PPCSubArch_spe = 31
}
enum VendorType : int {
    UnknownVendor = 0,
    Apple = 1,
    PC = 2,
    SCEI = 3,
    Freescale = 4,
    IBM = 5,
    ImaginationTechnologies = 6,
    MipsTechnologies = 7,
    NVIDIA = 8,
    CSR = 9,
    Myriad = 10,
    AMD = 11,
    Mesa = 12,
    SUSE = 13,
    OpenEmbedded = 14,
    LastVendorType = 14
}
enum OSType : int {
    UnknownOS = 0,
    Ananas = 1,
    CloudABI = 2,
    Darwin = 3,
    DragonFly = 4,
    FreeBSD = 5,
    Fuchsia = 6,
    IOS = 7,
    KFreeBSD = 8,
    Linux = 9,
    Lv2 = 10,
    MacOSX = 11,
    NetBSD = 12,
    OpenBSD = 13,
    Solaris = 14,
    Win32 = 15,
    ZOS = 16,
    Haiku = 17,
    Minix = 18,
    RTEMS = 19,
    NaCl = 20,
    AIX = 21,
    CUDA = 22,
    NVCL = 23,
    AMDHSA = 24,
    PS4 = 25,
    ELFIAMCU = 26,
    TvOS = 27,
    WatchOS = 28,
    Mesa3D = 29,
    Contiki = 30,
    AMDPAL = 31,
    HermitCore = 32,
    Hurd = 33,
    WASI = 34,
    Emscripten = 35,
    LastOSType = 35
}
enum EnvironmentType : int {
    UnknownEnvironment = 0,
    GNU = 1,
    GNUABIN32 = 2,
    GNUABI64 = 3,
    GNUEABI = 4,
    GNUEABIHF = 5,
    GNUX32 = 6,
    GNUILP32 = 7,
    CODE16 = 8,
    EABI = 9,
    EABIHF = 10,
    Android = 11,
    Musl = 12,
    MuslEABI = 13,
    MuslEABIHF = 14,
    MuslX32 = 15,
    MSVC = 16,
    Itanium = 17,
    Cygnus = 18,
    CoreCLR = 19,
    Simulator = 20,
    MacABI = 21,
    LastEnvironmentType = 21
}
enum ObjectFormatType : int {
    UnknownObjectFormat = 0,
    COFF = 1,
    ELF = 2,
    GOFF = 3,
    MachO = 4,
    Wasm = 5,
    XCOFF = 6
}
enum ARM_ArchKind : int {
    INVALID = 0,
    ARMV2 = 1,
    ARMV2A = 2,
    ARMV3 = 3,
    ARMV3M = 4,
    ARMV4 = 5,
    ARMV4T = 6,
    ARMV5T = 7,
    ARMV5TE = 8,
    IWMMXT = 9,
    IWMMXT2 = 10,
    XSCALE = 11,
    ARMV5TEJ = 12,
    ARMV6 = 13,
    ARMV6K = 14,
    ARMV6T2 = 15,
    ARMV6KZ = 16,
    ARMV6M = 17,
    ARMV7A = 18,
    ARMV7VE = 19,
    ARMV7R = 20,
    ARMV7M = 21,
    ARMV7S = 22,
    ARMV7EM = 23,
    ARMV7K = 24,
    ARMV8A = 25,
    ARMV8_1A = 26,
    ARMV8_2A = 27,
    ARMV8_3A = 28,
    ARMV8_4A = 29,
    ARMV8_5A = 30,
    ARMV8_6A = 31,
    ARMV8_7A = 32,
    ARMV8R = 33,
    ARMV8MBaseline = 34,
    ARMV8MMainline = 35,
    ARMV8_1MMainline = 36
}
enum ARM_ISAKind : int {
    INVALID = 0,
    ARM = 1,
    THUMB = 2,
    AARCH64 = 3
}
enum ARM_EndianKind : int {
    INVALID = 0,
    LITTLE = 1,
    BIG = 2
}
enum ARM_ProfileKind : int {
    INVALID = 0,
    A = 1,
    R = 2,
    M = 3
}
enum ARMBuildAttrs_CPUArch : int {
    Pre_v4 = 0,
    v4 = 1,
    v4T = 2,
    v5T = 3,
    v5TE = 4,
    v5TEJ = 5,
    v6 = 6,
    v6KZ = 7,
    v6T2 = 8,
    v6K = 9,
    v7 = 10,
    v6_M = 11,
    v6S_M = 12,
    v7E_M = 13,
    v8_A = 14,
    v8_R = 15,
    v8_M_Base = 16,
    v8_M_Main = 17,
    v8_1_M_Main = 21
}
enum FeatureKind : uint {
    FK_INVALID = 0u,
    FK_NONE = 1u,
    FK_STDEXTM = 4u,
    FK_STDEXTA = 8u,
    FK_STDEXTF = 16u,
    FK_STDEXTD = 32u,
    FK_STDEXTC = 64u,
    FK_64BIT = 128u
}
enum ArchExtKind : ulong {
    AEK_INVALID = 0uL,
    AEK_NONE = 1uL,
    AEK_CRC = 2uL,
    AEK_CRYPTO = 4uL,
    AEK_FP = 8uL,
    AEK_HWDIVTHUMB = 16uL,
    AEK_HWDIVARM = 32uL,
    AEK_MP = 64uL,
    AEK_SIMD = 128uL,
    AEK_SEC = 256uL,
    AEK_VIRT = 512uL,
    AEK_DSP = 1024uL,
    AEK_FP16 = 2048uL,
    AEK_RAS = 4096uL,
    AEK_DOTPROD = 8192uL,
    AEK_SHA2 = 16384uL,
    AEK_AES = 32768uL,
    AEK_FP16FML = 65536uL,
    AEK_SB = 131072uL,
    AEK_FP_DP = 262144uL,
    AEK_LOB = 524288uL,
    AEK_BF16 = 1048576uL,
    AEK_I8MM = 2097152uL,
    AEK_CDECP0 = 4194304uL,
    AEK_CDECP1 = 8388608uL,
    AEK_CDECP2 = 16777216uL,
    AEK_CDECP3 = 33554432uL,
    AEK_CDECP4 = 67108864uL,
    AEK_CDECP5 = 134217728uL,
    AEK_CDECP6 = 268435456uL,
    AEK_CDECP7 = 536870912uL,
    // Unsupported extensions.
    AEK_OS = 576460752303423488uL,
    AEK_IWMMXT = 1152921504606846976uL,
    AEK_IWMMXT2 = 2305843009213693952uL,
    AEK_MAVERICK = 4611686018427387904uL,
    AEK_XSCALE = 9223372036854775808uL
}
class Triple {
    dstring Data;
    ArchType Arch;
    SubArchType SubArch;
    VendorType Vendor;
    OSType OS;
    EnvironmentType Environment;
    ObjectFormatType ObjectFormat;
    this() { }
    this(dstring _Data, ArchType _Arch, SubArchType _SubArch, VendorType _Vendor, OSType _OS, EnvironmentType _Environment, ObjectFormatType _ObjectFormat) {
        this.Data = _Data;
        this.Arch = _Arch;
        this.SubArch = _SubArch;
        this.Vendor = _Vendor;
        this.OS = _OS;
        this.Environment = _Environment;
        this.ObjectFormat = _ObjectFormat;
    }
    this(dstring ArchStr, dstring VendorStr, dstring OSStr, dstring EnvironmentStr) {
        this.Data = ``d ~ ArchStr ~ `-`d ~ VendorStr ~ `-`d ~ OSStr ~ `-`d ~ EnvironmentStr ~ ``d;
        this.Arch = .parseArch(ArchStr);
        this.SubArch = .parseSubArch(ArchStr);
        this.Vendor = .parseVendor(VendorStr);
        this.OS = .parseOS(OSStr);
        this.Environment = .parseEnvironment(EnvironmentStr);
        this.ObjectFormat = .parseFormat(EnvironmentStr);
        if (this.ObjectFormat == ObjectFormatType.UnknownObjectFormat) {
            this.ObjectFormat = .getDefaultFormat(this);
        }
    }
    private 分割结果_ _分割(dstring 内容) {
        分割结果_ 结果 = new 分割结果_(""d, ""d);
        分割文本(内容, 字符_.减号, 结果);
        return 结果;
    }
    dstring getArchName() {
        return this._分割(this.Data).first;
    }
    dstring getVendorName() {
        dstring Tmp = this._分割(this.Data).second;
        return this._分割(Tmp).first;
    }
    dstring getOSName() {
        dstring Tmp = this._分割(this.Data).second;
        Tmp = this._分割(Tmp).second;
        return this._分割(Tmp).first;
    }
    OSType getOSType() {
        return this.OS;
    }
    SubArchType getSubArch() {
        return this.SubArch;
    }
    VendorType getVendor() {
        return this.Vendor;
    }
    dstring getEnvironmentName() {
        dstring Tmp = this._分割(this.Data).second;
        Tmp = this._分割(Tmp).second;
        return this._分割(Tmp).second;
    }
    dstring getOSAndEnvironmentName() {
        dstring Tmp = this._分割(this.Data).second;
        return this._分割(Tmp).second;
    }
    uint[3] getEnvironmentVersion() {
        dstring EnvironmentName = this.getEnvironmentName();
        dstring EnvironmentTypeName = .getEnvironmentTypeName(.getEnvironment(this));
        if (开始包含(EnvironmentName, EnvironmentTypeName)) {
            EnvironmentName = EnvironmentName[EnvironmentTypeName.length .. $];
        }
        return .parseVersionFromName(EnvironmentName);
    }
    uint[3] getOSVersion() {
        dstring OSName = this.getOSName();
        dstring OSTypeName = .getOSTypeName(this.OS);
        if (开始包含(OSName, OSTypeName)) {
            OSName = OSName[OSTypeName.length .. $];
        }
        else if (this.OS == OSType.MacOSX) {
            if (开始包含(OSName, "macos"d)) {
                OSName = OSName["macos"d.length .. $];
            }
        }
        return .parseVersionFromName(OSName);
    }
    bool getMacOSXVersion(ref uint[3] 版本号) {
        版本号 = this.getOSVersion();
        switch (this.OS) {
            case OSType.Darwin: {
                if (版本号[0] == 0) {
                    版本号[0] = 8;
                }
                if (版本号[0] < 4) {
                    return false;
                }
                if (版本号[0] <= 19) {
                    版本号[2] = 0;
                    版本号[1] = 版本号[0] - 4;
                    版本号[0] = 10;
                }
                else {
                    版本号[2] = 0;
                    版本号[1] = 0;
                    版本号[0] = 11 + 版本号[0] - 20;
                }
                break;
            }
            case OSType.MacOSX: {
                if (版本号[0] == 0) {
                    版本号[0] = 10;
                    版本号[1] = 4;
                }
                else if (版本号[0] < 10) {
                    return false;
                }
                break;
            }
            case OSType.IOS:
            case OSType.TvOS:
            case OSType.WatchOS: {
                版本号[0] = 10;
                版本号[1] = 4;
                版本号[2] = 0;
                break;
            }
            default: break;
        }
        return true;
    }
    uint[3] getiOSVersion() {
        uint[3] 版本号 = [0, 0, 0];
        switch (this.OS) {
            case OSType.Darwin:
            case OSType.MacOSX: {
                版本号[0] = 5;
                break;
            }
            case OSType.IOS:
            case OSType.TvOS: {
                版本号 = this.getOSVersion();
                if (版本号[0] == 0) {
                    版本号[0] = this.Arch == ArchType.aarch64 ? 7 : 5;
                }
            }
            default: break;
        }
        return 版本号;
    }
    uint[3] getWatchOSVersion() {
        uint[3] 版本号 = [0, 0, 0];
        switch (this.OS) {
            case OSType.Darwin:
            case OSType.MacOSX: {
                版本号[0] = 2;
                break;
            }
            case OSType.WatchOS: {
                版本号 = this.getOSVersion();
                if (版本号[0] == 0) {
                    版本号[0] = 2;
                }
            }
            default: break;
        }
        return 版本号;
    }
}
struct ARCHNames(T) {
    dstring NameCStr;
    dstring CPUAttrCStr;
    dstring SubArchCStr;
    FeatureKind DefaultFPU;
    ArchExtKind ArchBaseExtensions;
    T ID;
    ARMBuildAttrs_CPUArch ArchAttr;
    this(dstring NameCStr, T ID, dstring CPUAttrCStr, dstring SubArchCStr, ARMBuildAttrs_CPUArch ArchAttr, FeatureKind DefaultFPU, ArchExtKind ArchBaseExtensions) {
        this.NameCStr = NameCStr;
        this.ID = ID;
        this.CPUAttrCStr = CPUAttrCStr;
        this.SubArchCStr = SubArchCStr;
        this.DefaultFPU = DefaultFPU;
        this.ArchBaseExtensions = ArchBaseExtensions;
        this.ArchAttr = ArchAttr;
    }
}
dstring getOSTypeName(OSType Kind) {
    switch (Kind) {
        case OSType.AIX: {
            return "aix"d;
        }
        case OSType.AMDHSA: {
            return "amdhsa"d;
        }
        case OSType.AMDPAL: {
            return "amdpal"d;
        }
        case OSType.Ananas: {
            return "ananas"d;
        }
        case OSType.CUDA: {
            return "cuda"d;
        }
        case OSType.CloudABI: {
            return "cloudabi"d;
        }
        case OSType.Contiki: {
            return "contiki"d;
        }
        case OSType.Darwin: {
            return "darwin"d;
        }
        case OSType.DragonFly: {
            return "dragonfly"d;
        }
        case OSType.ELFIAMCU: {
            return "elfiamcu"d;
        }
        case OSType.Emscripten: {
            return "emscripten"d;
        }
        case OSType.FreeBSD: {
            return "freebsd"d;
        }
        case OSType.Fuchsia: {
            return "fuchsia"d;
        }
        case OSType.Haiku: {
            return "haiku"d;
        }
        case OSType.HermitCore: {
            return "hermit"d;
        }
        case OSType.Hurd: {
            return "hurd"d;
        }
        case OSType.IOS: {
            return "ios"d;
        }
        case OSType.KFreeBSD: {
            return "kfreebsd"d;
        }
        case OSType.Linux: {
            return "linux"d;
        }
        case OSType.Lv2: {
            return "lv2"d;
        }
        case OSType.MacOSX: {
            return "macosx"d;
        }
        case OSType.Mesa3D: {
            return "mesa3d"d;
        }
        case OSType.Minix: {
            return "minix"d;
        }
        case OSType.NVCL: {
            return "nvcl"d;
        }
        case OSType.NaCl: {
            return "nacl"d;
        }
        case OSType.NetBSD: {
            return "netbsd"d;
        }
        case OSType.OpenBSD: {
            return "openbsd"d;
        }
        case OSType.PS4: {
            return "ps4"d;
        }
        case OSType.RTEMS: {
            return "rtems"d;
        }
        case OSType.Solaris: {
            return "solaris"d;
        }
        case OSType.TvOS: {
            return "tvos"d;
        }
        case OSType.WASI: {
            return "wasi"d;
        }
        case OSType.WatchOS: {
            return "watchos"d;
        }
        case OSType.Win32: {
            return "windows"d;
        }
        case OSType.ZOS: {
            return "zos"d;
        }
        default: break;
    }
    return "unknown"d;
}
dstring getEnvironmentTypeName(EnvironmentType Kind) {
    switch (Kind) {
        case EnvironmentType.Android: {
            return "android"d;
        }
        case EnvironmentType.CODE16: {
            return "code16"d;
        }
        case EnvironmentType.CoreCLR: {
            return "coreclr"d;
        }
        case EnvironmentType.Cygnus: {
            return "cygnus"d;
        }
        case EnvironmentType.EABI: {
            return "eabi"d;
        }
        case EnvironmentType.EABIHF: {
            return "eabihf"d;
        }
        case EnvironmentType.GNU: {
            return "gnu"d;
        }
        case EnvironmentType.GNUABI64: {
            return "gnuabi64"d;
        }
        case EnvironmentType.GNUABIN32: {
            return "gnuabin32"d;
        }
        case EnvironmentType.GNUEABI: {
            return "gnueabi"d;
        }
        case EnvironmentType.GNUEABIHF: {
            return "gnueabihf"d;
        }
        case EnvironmentType.GNUX32: {
            return "gnux32"d;
        }
        case EnvironmentType.GNUILP32: {
            return "gnu_ilp32"d;
        }
        case EnvironmentType.Itanium: {
            return "itanium"d;
        }
        case EnvironmentType.MSVC: {
            return "msvc"d;
        }
        case EnvironmentType.MacABI: {
            return "macabi"d;
        }
        case EnvironmentType.Musl: {
            return "musl"d;
        }
        case EnvironmentType.MuslEABI: {
            return "musleabi"d;
        }
        case EnvironmentType.MuslEABIHF: {
            return "musleabihf"d;
        }
        case EnvironmentType.MuslX32: {
            return "muslx32"d;
        }
        case EnvironmentType.Simulator: {
            return "simulator"d;
        }
        default: break;
    }
    return "unknown"d;
}
uint[3] parseVersionFromName(dstring N) {
    dstring Name = N;
    uint[3] 部件 = [0, 0, 0];
    {
        for (int i = 0; i != 3; ++i) {
            if ((Name is ··null!(dstring)) || Name.length == 0 || Name[0] < cast(dchar)'0' || Name[0] > cast(dchar)'9') {
                break;
            }
            部件[i] = .EatNumber(Name);
            if (开始包含(Name, "."d)) {
                Name = Name[1 .. $];
            }
        }
    }
    return 部件;
}
uint EatNumber(ref dstring Str) {
    uint 结果 = 0;
    while((Str !is ··null!(dstring)) && Str.length > 0 && (cast(uint)(Str[0])) >= (cast(uint)(cast(dchar)'0')) && (cast(uint)(Str[0])) <= (cast(uint)(cast(dchar)'9'))) {
        结果 = 结果 * 10 + ((cast(uint)(Str[0])) - (cast(uint)(cast(dchar)'0')));
        Str = Str[1 .. $];
    }
    return 结果;
}
dstring getCanonicalArchName(dstring Arch) {
    long offset = -1;
    dstring A = Arch;
    dstring Error = ""d;
    if (开始包含(A, "arm64_32"d)) {
        offset = 8;
    }
    else if (开始包含(A, "arm64e"d)) {
        offset = 6;
    }
    else if (开始包含(A, "arm64"d)) {
        offset = 5;
    }
    else if (开始包含(A, "aarch64_32"d)) {
        offset = 10;
    }
    else if (开始包含(A, "arm"d)) {
        offset = 3;
    }
    else if (开始包含(A, "thumb"d)) {
        offset = 5;
    }
    else if (开始包含(A, "aarch64"d)) {
        offset = 7;
        if (查找索引(A, "eb"d) != -1) {
            return Error;
        }
        if (A[offset .. 3] == "_be"d) {
            offset += 3;
        }
    }
    if (offset != -1 && A[offset .. 2] == "eb"d) {
        offset += 2;
    }
    else if (结尾包含(A, "eb"d)) {
        A = A[0 .. A.length - 2];
    }
    if (offset != -1) {
        A = A[offset .. $];
    }
    if (A == ""d) {
        return Arch;
    }
    if (offset != -1) {
        if (A.length >= 2 && (A[0] != cast(dchar)'v' || 是数字类的(A[1]))) {
            return Error;
        }
        if (查找索引(A, "eb"d) != -1) {
            return Error;
        }
    }
    return A;
}
dstring ARM_getArchSynonym(dstring Arch) {
    switch (Arch) {
        case "v5"d: {
            return "v5t"d;
        }
        case "v5e"d: {
            return "v5te"d;
        }
        case "v6j"d: {
            return "v6"d;
        }
        case "v6hl"d: {
            return "v6k"d;
        }
        case "v6m"d:
        case "v6sm"d:
        case "v6s-m"d: {
            return "v6-m"d;
        }
        case "v6z"d:
        case "v6zk"d: {
            return "v6kz"d;
        }
        case "v7"d:
        case "v7a"d:
        case "v7hl"d:
        case "v7l"d: {
            return "v7-a"d;
        }
        case "v7r"d: {
            return "v7-r"d;
        }
        case "v7m"d: {
            return "v7-m"d;
        }
        case "v7em"d: {
            return "v7e-m"d;
        }
        case "v8"d:
        case "v8a"d:
        case "v8l"d:
        case "aarch64"d:
        case "arm64"d: {
            return "v8-a"d;
        }
        case "v8.1a"d: {
            return "v8.1-a"d;
        }
        case "v8.2a"d: {
            return "v8.2-a"d;
        }
        case "v8.3a"d: {
            return "v8.3-a"d;
        }
        case "v8.4a"d: {
            return "v8.4-a"d;
        }
        case "v8.5a"d: {
            return "v8.5-a"d;
        }
        case "v8.6a"d: {
            return "v8.6-a"d;
        }
        case "v8.7a"d: {
            return "v8.7-a"d;
        }
        case "v8r"d: {
            return "v8-r"d;
        }
        case "v8m.base"d: {
            return "v8-m.base"d;
        }
        case "v8m.main"d: {
            return "v8-m.main"d;
        }
        case "v8.1m.main"d: {
            return "v8.1-m.main"d;
        }
        default: {
            return Arch;
        }
    }
}
bool isMIPS32(Triple T) {
    return T.Arch == ArchType.mips || T.Arch == ArchType.mipsel;
}
bool isOSNetBSD(Triple T) {
    return T.getOSType() == OSType.NetBSD;
}
bool isOSLinux(Triple T) {
    return T.getOSType() == OSType.Linux;
}
bool isOSOpenBSD(Triple T) {
    return T.getOSType() == OSType.OpenBSD;
}
bool isWatchABI(Triple T) {
    return T.SubArch == SubArchType.ARMSubArch_v7k;
}
bool isOSBinFormatWasm(Triple T) {
    return T.ObjectFormat == ObjectFormatType.Wasm;
}
dstring ARM_getSubArch(ARM_ArchKind k) {
    return ARM_ARCHNames[(cast(uint)(k))].SubArchCStr;
}
ARCHNames!(ARM_ArchKind) ARM_ARCH(dstring NAME, ARM_ArchKind ID, dstring CPU_ATTR, dstring SUB_ARCH, ARMBuildAttrs_CPUArch ARCH_ATTR, FeatureKind ARCH_FPU, ArchExtKind ARCH_BASE_EXT) {
    return .ARCHNames!(ARM_ArchKind)(NAME, ID, CPU_ATTR, SUB_ARCH, ARCH_ATTR, ARCH_FPU, ARCH_BASE_EXT);
}
ARM_ArchKind ARM_parseArch(dstring ArchName) {
    dstring Arch = .getCanonicalArchName(ArchName);
    dstring Syn = .ARM_getArchSynonym(Arch);
    foreach (dstring key; _平台种类词典.键组()) {
        if (结尾包含(key, Syn) && _平台种类词典.具有(key)) {
            return _平台种类词典.获取(key);
        }
    }
    return ARM_ArchKind.INVALID;
}
ARM_ProfileKind parseArchProfile(dstring ArchString) {
    dstring Arch = .getCanonicalArchName(ArchString);
    switch (.ARM_parseArch(Arch)) {
        case ARM_ArchKind.ARMV6M:
        case ARM_ArchKind.ARMV7M:
        case ARM_ArchKind.ARMV7EM:
        case ARM_ArchKind.ARMV8MMainline:
        case ARM_ArchKind.ARMV8MBaseline:
        case ARM_ArchKind.ARMV8_1MMainline: {
            return ARM_ProfileKind.M;
        }
        case ARM_ArchKind.ARMV7R:
        case ARM_ArchKind.ARMV8R: {
            return ARM_ProfileKind.R;
        }
        case ARM_ArchKind.ARMV7A:
        case ARM_ArchKind.ARMV7VE:
        case ARM_ArchKind.ARMV7K:
        case ARM_ArchKind.ARMV8A:
        case ARM_ArchKind.ARMV8_1A:
        case ARM_ArchKind.ARMV8_2A:
        case ARM_ArchKind.ARMV8_3A:
        case ARM_ArchKind.ARMV8_4A:
        case ARM_ArchKind.ARMV8_5A:
        case ARM_ArchKind.ARMV8_6A:
        case ARM_ArchKind.ARMV8_7A: {
            return ARM_ProfileKind.A;
        }
        default: break;
    }
    return ARM_ProfileKind.INVALID;
}
ARM_ISAKind parseArchISA(dstring Arch) {
    if (开始包含(Arch, "aarch64"d)) {
        return ARM_ISAKind.AARCH64;
    }
    else if (开始包含(Arch, "arm64"d)) {
        return ARM_ISAKind.AARCH64;
    }
    else if (开始包含(Arch, "thumb"d)) {
        return ARM_ISAKind.THUMB;
    }
    else if (开始包含(Arch, "arm"d)) {
        return ARM_ISAKind.ARM;
    }
    else {
        return ARM_ISAKind.INVALID;
    }
}
long ARM_parseArchVersion(dstring Arch) {
    Arch = .getCanonicalArchName(Arch);
    switch (.ARM_parseArch(Arch)) {
        case ARM_ArchKind.ARMV2:
        case ARM_ArchKind.ARMV2A: {
            return 2;
        }
        case ARM_ArchKind.ARMV3:
        case ARM_ArchKind.ARMV3M: {
            return 3;
        }
        case ARM_ArchKind.ARMV4:
        case ARM_ArchKind.ARMV4T: {
            return 4;
        }
        case ARM_ArchKind.ARMV5T:
        case ARM_ArchKind.ARMV5TE:
        case ARM_ArchKind.IWMMXT:
        case ARM_ArchKind.IWMMXT2:
        case ARM_ArchKind.XSCALE:
        case ARM_ArchKind.ARMV5TEJ: {
            return 5;
        }
        case ARM_ArchKind.ARMV6:
        case ARM_ArchKind.ARMV6K:
        case ARM_ArchKind.ARMV6T2:
        case ARM_ArchKind.ARMV6KZ:
        case ARM_ArchKind.ARMV6M: {
            return 6;
        }
        case ARM_ArchKind.ARMV7A:
        case ARM_ArchKind.ARMV7VE:
        case ARM_ArchKind.ARMV7R:
        case ARM_ArchKind.ARMV7M:
        case ARM_ArchKind.ARMV7S:
        case ARM_ArchKind.ARMV7EM:
        case ARM_ArchKind.ARMV7K: {
            return 7;
        }
        case ARM_ArchKind.ARMV8A:
        case ARM_ArchKind.ARMV8_1A:
        case ARM_ArchKind.ARMV8_2A:
        case ARM_ArchKind.ARMV8_3A:
        case ARM_ArchKind.ARMV8_4A:
        case ARM_ArchKind.ARMV8_5A:
        case ARM_ArchKind.ARMV8_6A:
        case ARM_ArchKind.ARMV8_7A:
        case ARM_ArchKind.ARMV8R:
        case ARM_ArchKind.ARMV8MBaseline:
        case ARM_ArchKind.ARMV8MMainline:
        case ARM_ArchKind.ARMV8_1MMainline: {
            return 8;
        }
        case ARM_ArchKind.INVALID: {
            return 0;
        }
        default: {
            return 0;
        }
    }
}
ARM_EndianKind parseArchEndian(dstring Arch) {
    if (开始包含(Arch, "armeb"d) || 开始包含(Arch, "thumbeb"d) || 开始包含(Arch, "aarch64_be"d)) {
        return ARM_EndianKind.BIG;
    }
    if (开始包含(Arch, "arm"d) || 开始包含(Arch, "thumb"d)) {
        if (结尾包含(Arch, "eb"d)) {
            return ARM_EndianKind.BIG;
        }
        else {
            return ARM_EndianKind.LITTLE;
        }
    }
    if (开始包含(Arch, "aarch64"d) || 开始包含(Arch, "aarch64_32"d)) {
        return ARM_EndianKind.LITTLE;
    }
    return ARM_EndianKind.INVALID;
}
ArchType parseBPFArch(dstring ArchName) {
    if (ArchName == "bpf"d) {
        if (sys.是小端) {
            return ArchType.bpfel;
        }
        else {
            return ArchType.bpfeb;
        }
    }
    else if (ArchName == "bpf_be"d || ArchName == "bpfeb"d) {
        return ArchType.bpfeb;
    }
    else if (ArchName == "bpf_le"d || ArchName == "bpfel"d) {
        return ArchType.bpfel;
    }
    else {
        return ArchType.UnknownArch;
    }
}
ArchType parseARMArch(dstring ArchName) {
    ARM_ISAKind ISA = .parseArchISA(ArchName);
    ARM_EndianKind ENDIAN = .parseArchEndian(ArchName);
    ArchType arch = ArchType.UnknownArch;
    switch (ENDIAN) {
        case ARM_EndianKind.LITTLE: {
            switch (ISA) {
                case ARM_ISAKind.ARM: {
                    arch = ArchType.arm;
                    break;
                }
                case ARM_ISAKind.THUMB: {
                    arch = ArchType.thumb;
                    break;
                }
                case ARM_ISAKind.AARCH64: {
                    arch = ArchType.aarch64;
                    break;
                }
                case ARM_ISAKind.INVALID: {
                    break;
                }
                default: break;
            }
            break;
        }
        case ARM_EndianKind.BIG: {
            switch (ISA) {
                case ARM_ISAKind.ARM: {
                    arch = ArchType.armeb;
                    break;
                }
                case ARM_ISAKind.THUMB: {
                    arch = ArchType.thumbeb;
                    break;
                }
                case ARM_ISAKind.AARCH64: {
                    arch = ArchType.aarch64_be;
                    break;
                }
                case ARM_ISAKind.INVALID: {
                    break;
                }
                default: break;
            }
            break;
        }
        case ARM_EndianKind.INVALID: {
            break;
        }
        default: break;
    }
    ArchName = .getCanonicalArchName(ArchName);
    if (ArchName == ""d) {
        return ArchType.UnknownArch;
    }
    if (ISA == ARM_ISAKind.THUMB && (开始包含(ArchName, "v2"d) || 开始包含(ArchName, "v3"d))) {
        return ArchType.UnknownArch;
    }
    ARM_ProfileKind Profile = .parseArchProfile(ArchName);
    long Version = .ARM_parseArchVersion(ArchName);
    if (Profile == ARM_ProfileKind.M && Version == 6) {
        if (ENDIAN == ARM_EndianKind.BIG) {
            return ArchType.thumbeb;
        }
        else {
            return ArchType.thumb;
        }
    }
    return arch;
}
ArchType parseArch(dstring ArchName) {
    if (开始包含(ArchName, "kalimba"d)) {
        return ArchType.kalimba;
    }
    switch (ArchName) {
        case "i386"d:
        case "i486"d:
        case "i586"d:
        case "i686"d: {
            return ArchType.x86;
        }
        case "i786"d:
        case "i886"d:
        case "i986"d: {
            return ArchType.x86;
        }
        case "amd64"d:
        case "x86_64"d:
        case "x86_64h"d: {
            return ArchType.x86_64;
        }
        case "powerpc"d:
        case "powerpcspe"d:
        case "ppc"d:
        case "ppc32"d: {
            return ArchType.ppc;
        }
        case "powerpcle"d:
        case "ppcle"d:
        case "ppc32le"d: {
            return ArchType.ppcle;
        }
        case "powerpc64"d:
        case "ppu"d:
        case "ppc64"d: {
            return ArchType.ppc64;
        }
        case "powerpc64le"d:
        case "ppc64le"d: {
            return ArchType.ppc64le;
        }
        case "xscale"d: {
            return ArchType.arm;
        }
        case "xscaleeb"d: {
            return ArchType.armeb;
        }
        case "aarch64"d: {
            return ArchType.aarch64;
        }
        case "aarch64_be"d: {
            return ArchType.aarch64_be;
        }
        case "aarch64_32"d: {
            return ArchType.aarch64_32;
        }
        case "arc"d: {
            return ArchType.arc;
        }
        case "arm64"d: {
            return ArchType.aarch64;
        }
        case "arm64_32"d: {
            return ArchType.aarch64_32;
        }
        case "arm64e"d: {
            return ArchType.aarch64;
        }
        case "arm"d: {
            return ArchType.arm;
        }
        case "armeb"d: {
            return ArchType.armeb;
        }
        case "thumb"d: {
            return ArchType.thumb;
        }
        case "thumbeb"d: {
            return ArchType.thumbeb;
        }
        case "avr"d: {
            return ArchType.avr;
        }
        case "m68k"d: {
            return ArchType.m68k;
        }
        case "msp430"d: {
            return ArchType.msp430;
        }
        case "mips"d:
        case "mipseb"d:
        case "mipsallegrex"d:
        case "mipsisa32r6"d:
        case "mipsr6"d: {
            return ArchType.mips;
        }
        case "mipsel"d:
        case "mipsallegrexel"d:
        case "mipsisa32r6el"d:
        case "mipsr6el"d: {
            return ArchType.mipsel;
        }
        case "mips64"d:
        case "mips64eb"d:
        case "mipsn32"d:
        case "mipsisa64r6"d:
        case "mips64r6"d:
        case "mipsn32r6"d: {
            return ArchType.mips64;
        }
        case "mips64el"d:
        case "mipsn32el"d:
        case "mipsisa64r6el"d:
        case "mips64r6el"d:
        case "mipsn32r6el"d: {
            return ArchType.mips64el;
        }
        case "r600"d: {
            return ArchType.r600;
        }
        case "amdgcn"d: {
            return ArchType.amdgcn;
        }
        case "riscv32"d: {
            return ArchType.riscv32;
        }
        case "riscv64"d: {
            return ArchType.riscv64;
        }
        case "hexagon"d: {
            return ArchType.hexagon;
        }
        case "s390x"d:
        case "systemz"d: {
            return ArchType.systemz;
        }
        case "sparc"d: {
            return ArchType.sparc;
        }
        case "sparcel"d: {
            return ArchType.sparcel;
        }
        case "sparcv9"d:
        case "sparc64"d: {
            return ArchType.sparcv9;
        }
        case "tce"d: {
            return ArchType.tce;
        }
        case "tcele"d: {
            return ArchType.tcele;
        }
        case "xcore"d: {
            return ArchType.xcore;
        }
        case "nvptx"d: {
            return ArchType.nvptx;
        }
        case "nvptx64"d: {
            return ArchType.nvptx64;
        }
        case "le32"d: {
            return ArchType.le32;
        }
        case "le64"d: {
            return ArchType.le64;
        }
        case "amdil"d: {
            return ArchType.amdil;
        }
        case "amdil64"d: {
            return ArchType.amdil64;
        }
        case "hsail"d: {
            return ArchType.hsail;
        }
        case "hsail64"d: {
            return ArchType.hsail64;
        }
        case "spir"d: {
            return ArchType.spir;
        }
        case "spir64"d: {
            return ArchType.spir64;
        }
        case "lanai"d: {
            return ArchType.lanai;
        }
        case "renderscript32"d: {
            return ArchType.renderscript32;
        }
        case "renderscript64"d: {
            return ArchType.renderscript64;
        }
        case "shave"d: {
            return ArchType.shave;
        }
        case "ve"d: {
            return ArchType.ve;
        }
        case "wasm32"d: {
            return ArchType.wasm32;
        }
        case "wasm64"d: {
            return ArchType.wasm64;
        }
        case "csky"d: {
            return ArchType.csky;
        }
        default: {
            if (开始包含(ArchName, "arm"d) || 开始包含(ArchName, "thumb"d) || 开始包含(ArchName, "aarch64"d)) {
                return .parseARMArch(ArchName);
            }
            if (开始包含(ArchName, "bpf"d)) {
                return .parseBPFArch(ArchName);
            }
            return ArchType.UnknownArch;
        }
    }
}
SubArchType parseSubArch(dstring SubArchName) {
    if (开始包含(SubArchName, "mips"d) && (结尾包含(SubArchName, "r6el"d) || 结尾包含(SubArchName, "r6"d))) {
        return SubArchType.MipsSubArch_r6;
    }
    if (SubArchName == "powerpcspe"d) {
        return SubArchType.PPCSubArch_spe;
    }
    if (SubArchName == "arm64e"d) {
        return SubArchType.AArch64SubArch_arm64e;
    }
    dstring ARMSubArch = .getCanonicalArchName(SubArchName);
    if (ARMSubArch == ""d) {
        if (结尾包含(SubArchName, "kalimba3"d)) {
            return SubArchType.KalimbaSubArch_v3;
        }
        else if (结尾包含(SubArchName, "kalimba4"d)) {
            return SubArchType.KalimbaSubArch_v4;
        }
        else if (结尾包含(SubArchName, "kalimba5"d)) {
            return SubArchType.KalimbaSubArch_v5;
        }
        else {
            return SubArchType.NoSubArch;
        }
    }
    switch (.ARM_parseArch(ARMSubArch)) {
        case ARM_ArchKind.ARMV4: {
            return SubArchType.NoSubArch;
        }
        case ARM_ArchKind.ARMV4T: {
            return SubArchType.ARMSubArch_v4t;
        }
        case ARM_ArchKind.ARMV5T: {
            return SubArchType.ARMSubArch_v5;
        }
        case ARM_ArchKind.ARMV5TE:
        case ARM_ArchKind.IWMMXT:
        case ARM_ArchKind.IWMMXT2:
        case ARM_ArchKind.XSCALE:
        case ARM_ArchKind.ARMV5TEJ: {
            return SubArchType.ARMSubArch_v5te;
        }
        case ARM_ArchKind.ARMV6: {
            return SubArchType.ARMSubArch_v6;
        }
        case ARM_ArchKind.ARMV6K:
        case ARM_ArchKind.ARMV6KZ: {
            return SubArchType.ARMSubArch_v6k;
        }
        case ARM_ArchKind.ARMV6T2: {
            return SubArchType.ARMSubArch_v6t2;
        }
        case ARM_ArchKind.ARMV6M: {
            return SubArchType.ARMSubArch_v6m;
        }
        case ARM_ArchKind.ARMV7A:
        case ARM_ArchKind.ARMV7R: {
            return SubArchType.ARMSubArch_v7;
        }
        case ARM_ArchKind.ARMV7VE: {
            return SubArchType.ARMSubArch_v7ve;
        }
        case ARM_ArchKind.ARMV7K: {
            return SubArchType.ARMSubArch_v7k;
        }
        case ARM_ArchKind.ARMV7M: {
            return SubArchType.ARMSubArch_v7m;
        }
        case ARM_ArchKind.ARMV7S: {
            return SubArchType.ARMSubArch_v7s;
        }
        case ARM_ArchKind.ARMV7EM: {
            return SubArchType.ARMSubArch_v7em;
        }
        case ARM_ArchKind.ARMV8A: {
            return SubArchType.ARMSubArch_v8;
        }
        case ARM_ArchKind.ARMV8_1A: {
            return SubArchType.ARMSubArch_v8_1a;
        }
        case ARM_ArchKind.ARMV8_2A: {
            return SubArchType.ARMSubArch_v8_2a;
        }
        case ARM_ArchKind.ARMV8_3A: {
            return SubArchType.ARMSubArch_v8_3a;
        }
        case ARM_ArchKind.ARMV8_4A: {
            return SubArchType.ARMSubArch_v8_4a;
        }
        case ARM_ArchKind.ARMV8_5A: {
            return SubArchType.ARMSubArch_v8_5a;
        }
        case ARM_ArchKind.ARMV8_6A: {
            return SubArchType.ARMSubArch_v8_6a;
        }
        case ARM_ArchKind.ARMV8_7A: {
            return SubArchType.ARMSubArch_v8_7a;
        }
        case ARM_ArchKind.ARMV8R: {
            return SubArchType.ARMSubArch_v8r;
        }
        case ARM_ArchKind.ARMV8MBaseline: {
            return SubArchType.ARMSubArch_v8m_baseline;
        }
        case ARM_ArchKind.ARMV8MMainline: {
            return SubArchType.ARMSubArch_v8m_mainline;
        }
        case ARM_ArchKind.ARMV8_1MMainline: {
            return SubArchType.ARMSubArch_v8_1m_mainline;
        }
        default: {
            return SubArchType.NoSubArch;
        }
    }
}
VendorType parseVendor(dstring VendorName) {
    switch (VendorName) {
        case "apple"d: {
            return VendorType.Apple;
        }
        case "pc"d: {
            return VendorType.PC;
        }
        case "scei"d: {
            return VendorType.SCEI;
        }
        case "sie"d: {
            return VendorType.SCEI;
        }
        case "fsl"d: {
            return VendorType.Freescale;
        }
        case "ibm"d: {
            return VendorType.IBM;
        }
        case "img"d: {
            return VendorType.ImaginationTechnologies;
        }
        case "mti"d: {
            return VendorType.MipsTechnologies;
        }
        case "nvidia"d: {
            return VendorType.NVIDIA;
        }
        case "csr"d: {
            return VendorType.CSR;
        }
        case "myriad"d: {
            return VendorType.Myriad;
        }
        case "amd"d: {
            return VendorType.AMD;
        }
        case "mesa"d: {
            return VendorType.Mesa;
        }
        case "suse"d: {
            return VendorType.SUSE;
        }
        case "oe"d: {
            return VendorType.OpenEmbedded;
        }
        default: {
            return VendorType.UnknownVendor;
        }
    }
}
OSType parseOS(dstring OSName) {
    if (开始包含(OSName, "ananas"d)) {
        return OSType.Ananas;
    }
    else if (开始包含(OSName, "cloudabi"d)) {
        return OSType.CloudABI;
    }
    else if (开始包含(OSName, "darwin"d)) {
        return OSType.Darwin;
    }
    else if (开始包含(OSName, "dragonfly"d)) {
        return OSType.DragonFly;
    }
    else if (开始包含(OSName, "freebsd"d)) {
        return OSType.FreeBSD;
    }
    else if (开始包含(OSName, "fuchsia"d)) {
        return OSType.Fuchsia;
    }
    else if (开始包含(OSName, "ios"d)) {
        return OSType.IOS;
    }
    else if (开始包含(OSName, "kfreebsd"d)) {
        return OSType.KFreeBSD;
    }
    else if (开始包含(OSName, "linux"d)) {
        return OSType.Linux;
    }
    else if (开始包含(OSName, "lv2"d)) {
        return OSType.Lv2;
    }
    else if (开始包含(OSName, "macos"d)) {
        return OSType.MacOSX;
    }
    else if (开始包含(OSName, "netbsd"d)) {
        return OSType.NetBSD;
    }
    else if (开始包含(OSName, "openbsd"d)) {
        return OSType.OpenBSD;
    }
    else if (开始包含(OSName, "solaris"d)) {
        return OSType.Solaris;
    }
    else if (开始包含(OSName, "win32"d)) {
        return OSType.Win32;
    }
    else if (开始包含(OSName, "windows"d)) {
        return OSType.Win32;
    }
    else if (开始包含(OSName, "zos"d)) {
        return OSType.ZOS;
    }
    else if (开始包含(OSName, "haiku"d)) {
        return OSType.Haiku;
    }
    else if (开始包含(OSName, "minix"d)) {
        return OSType.Minix;
    }
    else if (开始包含(OSName, "rtems"d)) {
        return OSType.RTEMS;
    }
    else if (开始包含(OSName, "nacl"d)) {
        return OSType.NaCl;
    }
    else if (开始包含(OSName, "aix"d)) {
        return OSType.AIX;
    }
    else if (开始包含(OSName, "cuda"d)) {
        return OSType.CUDA;
    }
    else if (开始包含(OSName, "nvcl"d)) {
        return OSType.NVCL;
    }
    else if (开始包含(OSName, "amdhsa"d)) {
        return OSType.AMDHSA;
    }
    else if (开始包含(OSName, "ps4"d)) {
        return OSType.PS4;
    }
    else if (开始包含(OSName, "elfiamcu"d)) {
        return OSType.ELFIAMCU;
    }
    else if (开始包含(OSName, "tvos"d)) {
        return OSType.TvOS;
    }
    else if (开始包含(OSName, "watchos"d)) {
        return OSType.WatchOS;
    }
    else if (开始包含(OSName, "mesa3d"d)) {
        return OSType.Mesa3D;
    }
    else if (开始包含(OSName, "contiki"d)) {
        return OSType.Contiki;
    }
    else if (开始包含(OSName, "amdpal"d)) {
        return OSType.AMDPAL;
    }
    else if (开始包含(OSName, "hermit"d)) {
        return OSType.HermitCore;
    }
    else if (开始包含(OSName, "hurd"d)) {
        return OSType.Hurd;
    }
    else if (开始包含(OSName, "wasi"d)) {
        return OSType.WASI;
    }
    else if (开始包含(OSName, "emscripten"d)) {
        return OSType.Emscripten;
    }
    else {
        return OSType.UnknownOS;
    }
}
EnvironmentType parseEnvironment(dstring EnvironmentName) {
    if (开始包含(EnvironmentName, "eabihf"d)) {
        return EnvironmentType.EABIHF;
    }
    else if (开始包含(EnvironmentName, "eabi"d)) {
        return EnvironmentType.EABI;
    }
    else if (开始包含(EnvironmentName, "gnuabin32"d)) {
        return EnvironmentType.GNUABIN32;
    }
    else if (开始包含(EnvironmentName, "gnuabi64"d)) {
        return EnvironmentType.GNUABI64;
    }
    else if (开始包含(EnvironmentName, "gnueabihf"d)) {
        return EnvironmentType.GNUEABIHF;
    }
    else if (开始包含(EnvironmentName, "gnueabi"d)) {
        return EnvironmentType.GNUEABI;
    }
    else if (开始包含(EnvironmentName, "gnux32"d)) {
        return EnvironmentType.GNUX32;
    }
    else if (开始包含(EnvironmentName, "gnu_ilp32"d)) {
        return EnvironmentType.GNUILP32;
    }
    else if (开始包含(EnvironmentName, "code16"d)) {
        return EnvironmentType.CODE16;
    }
    else if (开始包含(EnvironmentName, "gnu"d)) {
        return EnvironmentType.GNU;
    }
    else if (开始包含(EnvironmentName, "android"d)) {
        return EnvironmentType.Android;
    }
    else if (开始包含(EnvironmentName, "musleabihf"d)) {
        return EnvironmentType.MuslEABIHF;
    }
    else if (开始包含(EnvironmentName, "musleabi"d)) {
        return EnvironmentType.MuslEABI;
    }
    else if (开始包含(EnvironmentName, "muslx32"d)) {
        return EnvironmentType.MuslX32;
    }
    else if (开始包含(EnvironmentName, "musl"d)) {
        return EnvironmentType.Musl;
    }
    else if (开始包含(EnvironmentName, "msvc"d)) {
        return EnvironmentType.MSVC;
    }
    else if (开始包含(EnvironmentName, "itanium"d)) {
        return EnvironmentType.Itanium;
    }
    else if (开始包含(EnvironmentName, "cygnus"d)) {
        return EnvironmentType.Cygnus;
    }
    else if (开始包含(EnvironmentName, "coreclr"d)) {
        return EnvironmentType.CoreCLR;
    }
    else if (开始包含(EnvironmentName, "simulator"d)) {
        return EnvironmentType.Simulator;
    }
    else if (开始包含(EnvironmentName, "macabi"d)) {
        return EnvironmentType.MacABI;
    }
    else {
        return EnvironmentType.UnknownEnvironment;
    }
}
ObjectFormatType parseFormat(dstring EnvironmentName) {
    if (结尾包含(EnvironmentName, "xcoff"d)) {
        return ObjectFormatType.XCOFF;
    }
    else if (结尾包含(EnvironmentName, "coff"d)) {
        return ObjectFormatType.COFF;
    }
    else if (结尾包含(EnvironmentName, "elf"d)) {
        return ObjectFormatType.ELF;
    }
    else if (结尾包含(EnvironmentName, "goff"d)) {
        return ObjectFormatType.GOFF;
    }
    else if (结尾包含(EnvironmentName, "macho"d)) {
        return ObjectFormatType.MachO;
    }
    else if (结尾包含(EnvironmentName, "wasm"d)) {
        return ObjectFormatType.Wasm;
    }
    else {
        return ObjectFormatType.UnknownObjectFormat;
    }
}
int getArchPointerBitWidth(ArchType Arch) {
    switch (Arch) {
        case ArchType.UnknownArch: {
            return 0;
        }
        case ArchType.avr:
        case ArchType.msp430: {
            return 16;
        }
        case ArchType.aarch64_32:
        case ArchType.amdil:
        case ArchType.arc:
        case ArchType.arm:
        case ArchType.armeb:
        case ArchType.csky:
        case ArchType.hexagon:
        case ArchType.hsail:
        case ArchType.kalimba:
        case ArchType.lanai:
        case ArchType.le32:
        case ArchType.m68k:
        case ArchType.mips:
        case ArchType.mipsel:
        case ArchType.nvptx:
        case ArchType.ppc:
        case ArchType.ppcle:
        case ArchType.r600:
        case ArchType.renderscript32:
        case ArchType.riscv32:
        case ArchType.shave:
        case ArchType.sparc:
        case ArchType.sparcel:
        case ArchType.spir:
        case ArchType.tce:
        case ArchType.tcele:
        case ArchType.thumb:
        case ArchType.thumbeb:
        case ArchType.wasm32:
        case ArchType.x86:
        case ArchType.xcore: {
            return 32;
        }
        case ArchType.aarch64:
        case ArchType.aarch64_be:
        case ArchType.amdgcn:
        case ArchType.amdil64:
        case ArchType.bpfeb:
        case ArchType.bpfel:
        case ArchType.hsail64:
        case ArchType.le64:
        case ArchType.mips64:
        case ArchType.mips64el:
        case ArchType.nvptx64:
        case ArchType.ppc64:
        case ArchType.ppc64le:
        case ArchType.renderscript64:
        case ArchType.riscv64:
        case ArchType.sparcv9:
        case ArchType.spir64:
        case ArchType.systemz:
        case ArchType.ve:
        case ArchType.wasm64:
        case ArchType.x86_64: {
            return 64;
        }
        default: break;
    }
    return 64;
}
dstring getObjectFormatTypeName(ObjectFormatType Kind) {
    switch (Kind) {
        case ObjectFormatType.COFF: {
            return "coff"d;
        }
        case ObjectFormatType.ELF: {
            return "elf"d;
        }
        case ObjectFormatType.GOFF: {
            return "goff"d;
        }
        case ObjectFormatType.MachO: {
            return "macho"d;
        }
        case ObjectFormatType.Wasm: {
            return "wasm"d;
        }
        case ObjectFormatType.XCOFF: {
            return "xcoff"d;
        }
        default: break;
    }
    return ""d;
}
bool isWatchOS(Triple T) {
    return T.OS == OSType.WatchOS;
}
bool isTvOS(Triple T) {
    return T.OS == OSType.TvOS;
}
bool isiOS(Triple T) {
    return T.OS == OSType.IOS || .isTvOS(T);
}
bool isMacOSX(Triple T) {
    return T.OS == OSType.Darwin || T.OS == OSType.MacOSX;
}
bool isOSDarwin(Triple T) {
    return .isMacOSX(T) || .isiOS(T) || .isWatchOS(T);
}
bool isOSWindows(Triple T) {
    return T.OS == OSType.Win32;
}
bool isOSAIX(Triple T) {
    return T.OS == OSType.AIX;
}
bool isOSzOS(Triple T) {
    return T.OS == OSType.ZOS;
}
bool isOSBinFormatMachO(Triple T) {
    return T.ObjectFormat == ObjectFormatType.MachO;
}
bool isOSBinFormatELF(Triple T) {
    return T.ObjectFormat == ObjectFormatType.ELF;
}
bool isMusl(Triple T) {
    return .getEnvironment(T) == EnvironmentType.Musl || .getEnvironment(T) == EnvironmentType.MuslEABI || .getEnvironment(T) == EnvironmentType.MuslEABIHF || .getEnvironment(T) == EnvironmentType.MuslX32;
}
EnvironmentType getEnvironment(Triple T) { return T.Environment; }
bool isKnownWindowsMSVCEnvironment(Triple T) {
    return .isOSWindows(T) && .getEnvironment(T) == EnvironmentType.MSVC;
}
bool isWindowsMSVCEnvironment(Triple T) {
    return .isKnownWindowsMSVCEnvironment(T) || (.isOSWindows(T) && .getEnvironment(T) == EnvironmentType.UnknownEnvironment);
}
bool isWindowsCoreCLREnvironment(Triple T) {
    return .isOSWindows(T) && .getEnvironment(T) == EnvironmentType.CoreCLR;
}
bool isWindowsGNUEnvironment(Triple T) {
    return .isOSWindows(T) && .getEnvironment(T) == EnvironmentType.GNU;
}
bool isWindowsItaniumEnvironment(Triple T) {
    return .isOSWindows(T) && .getEnvironment(T) == EnvironmentType.Itanium;
}
bool isOSCygMing(Triple T) {
    return .isWindowsCygwinEnvironment(T) || .isWindowsGNUEnvironment(T);
}
bool isWindowsCygwinEnvironment(Triple T) {
    return .isOSWindows(T) && .getEnvironment(T) == EnvironmentType.Cygnus;
}
bool isOSBinFormatCOFF(Triple T) {
    return T.ObjectFormat == ObjectFormatType.COFF;
}
bool isOSBinFormatXCOFF(Triple T) {
    return T.ObjectFormat == ObjectFormatType.XCOFF;
}
bool isArch64Bit(Triple T) {
    return .getArchPointerBitWidth(T.Arch) == 64;
}
bool isArch32Bit(Triple T) {
    return .getArchPointerBitWidth(T.Arch) == 32;
}
bool isX32(Triple T) {
    return T.Environment == EnvironmentType.GNUX32 || T.Environment == EnvironmentType.MuslX32;
}
bool isOSNaCl(Triple T) {
    return T.OS == OSType.NaCl;
}
bool isOSIAMCU(Triple T) {
    return T.OS == OSType.ELFIAMCU;
}
bool isAMDGCN(Triple T) {
    return T.Arch == ArchType.amdgcn;
}
bool isLittleEndian(Triple T) {
    switch (T.Arch) {
        case ArchType.aarch64:
        case ArchType.aarch64_32:
        case ArchType.amdgcn:
        case ArchType.amdil64:
        case ArchType.amdil:
        case ArchType.arm:
        case ArchType.avr:
        case ArchType.bpfel:
        case ArchType.csky:
        case ArchType.hexagon:
        case ArchType.hsail64:
        case ArchType.hsail:
        case ArchType.kalimba:
        case ArchType.le32:
        case ArchType.le64:
        case ArchType.mips64el:
        case ArchType.mipsel:
        case ArchType.msp430:
        case ArchType.nvptx64:
        case ArchType.nvptx:
        case ArchType.ppcle:
        case ArchType.ppc64le:
        case ArchType.r600:
        case ArchType.renderscript32:
        case ArchType.renderscript64:
        case ArchType.riscv32:
        case ArchType.riscv64:
        case ArchType.shave:
        case ArchType.sparcel:
        case ArchType.spir64:
        case ArchType.spir:
        case ArchType.tcele:
        case ArchType.thumb:
        case ArchType.ve:
        case ArchType.wasm32:
        case ArchType.wasm64:
        case ArchType.x86:
        case ArchType.x86_64:
        case ArchType.xcore: {
            return true;
        }
        default: {
            return false;
        }
    }
}
ObjectFormatType getDefaultFormat(Triple T) {
    switch (T.Arch) {
        case ArchType.UnknownArch:
        case ArchType.aarch64:
        case ArchType.aarch64_32:
        case ArchType.arm:
        case ArchType.thumb:
        case ArchType.x86:
        case ArchType.x86_64: {
            if (.isOSDarwin(T)) {
                return ObjectFormatType.MachO;
            }
            else if (.isOSWindows(T)) {
                return ObjectFormatType.COFF;
            }
            return ObjectFormatType.ELF;
        }
        case ArchType.aarch64_be:
        case ArchType.amdgcn:
        case ArchType.amdil64:
        case ArchType.amdil:
        case ArchType.arc:
        case ArchType.armeb:
        case ArchType.avr:
        case ArchType.bpfeb:
        case ArchType.bpfel:
        case ArchType.csky:
        case ArchType.hexagon:
        case ArchType.hsail64:
        case ArchType.hsail:
        case ArchType.kalimba:
        case ArchType.lanai:
        case ArchType.le32:
        case ArchType.le64:
        case ArchType.m68k:
        case ArchType.mips64:
        case ArchType.mips64el:
        case ArchType.mips:
        case ArchType.mipsel:
        case ArchType.msp430:
        case ArchType.nvptx64:
        case ArchType.nvptx:
        case ArchType.ppc64le:
        case ArchType.ppcle:
        case ArchType.r600:
        case ArchType.renderscript32:
        case ArchType.renderscript64:
        case ArchType.riscv32:
        case ArchType.riscv64:
        case ArchType.shave:
        case ArchType.sparc:
        case ArchType.sparcel:
        case ArchType.sparcv9:
        case ArchType.spir64:
        case ArchType.spir:
        case ArchType.tce:
        case ArchType.tcele:
        case ArchType.thumbeb:
        case ArchType.ve:
        case ArchType.xcore: {
            return ObjectFormatType.ELF;
        }
        case ArchType.ppc64:
        case ArchType.ppc: {
            if (.isOSAIX(T)) {
                return ObjectFormatType.XCOFF;
            }
            return ObjectFormatType.ELF;
        }
        case ArchType.systemz: {
            if (.isOSzOS(T)) {
                return ObjectFormatType.GOFF;
            }
            return ObjectFormatType.ELF;
        }
        case ArchType.wasm32:
        case ArchType.wasm64: {
            return ObjectFormatType.Wasm;
        }
        default: break;
    }
    return ObjectFormatType.UnknownObjectFormat;
}
Triple 编译目标平台内容(dstring str) {
    dstring Data = .标准化目标平台文本(str);
    str = Data;
    dstring[] Components = 分割(str, ["-"d]);
    ArchType Arch = ArchType.UnknownArch;
    SubArchType SubArch = SubArchType.NoSubArch;
    VendorType Vendor = VendorType.UnknownVendor;
    OSType OS = OSType.UnknownOS;
    EnvironmentType Environment = EnvironmentType.UnknownEnvironment;
    ObjectFormatType ObjectFormat = ObjectFormatType.UnknownObjectFormat;
    if (Components.length > 0) {
        Arch = .parseArch(Components[0]);
        SubArch = .parseSubArch(Components[0]);
        if (Components.length > 1) {
            Vendor = .parseVendor(Components[1]);
            if (Components.length > 2) {
                OS = .parseOS(Components[2]);
                if (Components.length > 3) {
                    Environment = .parseEnvironment(Components[3]);
                    ObjectFormat = .parseFormat(Components[3]);
                }
            }
        }
        else {
            dstring Component = Components[0];
            if (Component == "mips"d || Component == "mipsel"d || Component == "mipsr6"d || Component == "mipsr6el"d) {
                Environment = EnvironmentType.GNUABIN32;
            }
            else if (开始包含(Component, "mipsn32"d)) {
                Environment = EnvironmentType.GNUABIN32;
            }
            else if (开始包含(Component, "mips64"d)) {
                Environment = EnvironmentType.GNUABI64;
            }
            else if (开始包含(Component, "mipsisa64"d)) {
                Environment = EnvironmentType.GNUABI64;
            }
            else if (开始包含(Component, "mipsisa32"d)) {
                Environment = EnvironmentType.GNU;
            }
            else {
                Environment = EnvironmentType.UnknownEnvironment;
            }
        }
    }
    if (Arch == ArchType.UnknownArch) {
        Arch = ArchType.x86_64;
    }
    if (OS == OSType.UnknownOS) {
        OS = OSType.Win32;
    }
    Triple triple = new Triple(Data, Arch, SubArch, Vendor, OS, Environment, ObjectFormat);
    if (triple.ObjectFormat == ObjectFormatType.UnknownObjectFormat) {
        triple.ObjectFormat = .getDefaultFormat(triple);
    }
    return triple;
}
dstring 标准化目标平台文本(dstring Str) {
    bool IsMinGW32 = false;
    bool IsCygwin = false;
    dstring[] Components = 分割(替换(Str, ","d, "-"d), ["-"d]);
    ArchType Arch = ArchType.UnknownArch;
    if (Components.length > 0) {
        Arch = .parseArch(Components[0]);
    }
    VendorType Vendor = VendorType.UnknownVendor;
    if (Components.length > 1) {
        Vendor = .parseVendor(Components[1]);
    }
    OSType OS = OSType.UnknownOS;
    if (Components.length > 2) {
        OS = .parseOS(Components[2]);
        IsCygwin = 开始包含(Components[2], "cygwin"d);
        IsMinGW32 = 开始包含(Components[2], "mingw"d);
    }
    EnvironmentType Environment = EnvironmentType.UnknownEnvironment;
    if (Components.length > 3) {
        Environment = .parseEnvironment(Components[3]);
    }
    ObjectFormatType ObjectFormat = ObjectFormatType.UnknownObjectFormat;
    if (Components.length > 4) {
        ObjectFormat = .parseFormat(Components[4]);
    }
    bool[4] Found = [Arch != ArchType.UnknownArch, Vendor != VendorType.UnknownVendor, OS != OSType.UnknownOS, Environment != EnvironmentType.UnknownEnvironment];
    {
        for (int Pos = 0; Pos != Found.length; ++Pos) {
            if (Found[Pos]) {
                continue;
            }
            {
                for (int Idx = 0; Idx != Components.length; ++Idx) {
                    if (Idx < Found.length && Found[Idx]) {
                        continue;
                    }
                    bool Valid = false;
                    dstring Comp = Components[Idx];
                    switch (Pos) {
                        case 0: {
                            Arch = .parseArch(Comp);
                            Valid = Arch != ArchType.UnknownArch;
                            break;
                        }
                        case 1: {
                            Vendor = .parseVendor(Comp);
                            Valid = Vendor != VendorType.UnknownVendor;
                            break;
                        }
                        case 2: {
                            OS = .parseOS(Comp);
                            IsCygwin = 开始包含(Comp, "cygwin"d);
                            IsMinGW32 = 开始包含(Comp, "mingw"d);
                            Valid = OS != OSType.UnknownOS || IsCygwin || IsMinGW32;
                            break;
                        }
                        case 3: {
                            Environment = .parseEnvironment(Comp);
                            Valid = Environment != EnvironmentType.UnknownEnvironment;
                            if (!Valid) {
                                ObjectFormat = .parseFormat(Comp);
                                Valid = ObjectFormat != ObjectFormatType.UnknownObjectFormat;
                            }
                            break;
                        }
                        default: {
                            break;
                        }
                    }
                    if (!Valid) {
                        continue;
                    }
                    if (Pos < Idx) {
                        dstring CurrentComponent = Components[Idx];
                        {
                            for (int i = Pos; CurrentComponent != ""d; ++i) {
                                while(i < Found.length && Found[i]) {
                                    ++i;
                                }
                                CurrentComponent = Components[i];
                            }
                        }
                    }
                    else if (Pos > Idx) {
                        dstring CurrentComponent = ""d;
                        {
                            for (int i = Idx; i < Components.length;) {
                                CurrentComponent = Components[i];
                                if (CurrentComponent == ""d) {
                                    break;
                                }
                                while(++i < Found.length && Found[i]) { }
                            }
                        }
                        if (CurrentComponent != ""d) {
                            .追加!(dstring)(Components, CurrentComponent);
                        }
                        while(++Idx < Found.length && Found[Idx]) { }
                        while(Idx < Pos) {
                            {
                                for (int i = Idx; i < Components.length;) {
                                    CurrentComponent = Components[i];
                                    if (CurrentComponent is ··null!(dstring)) {
                                        break;
                                    }
                                    while(++i < Found.length && Found[i]) { }
                                }
                            }
                            if (CurrentComponent != ""d) {
                                .追加!(dstring)(Components, CurrentComponent);
                            }
                            while(++Idx < Found.length && Found[Idx]) { }
                        }
                    }
                    Found[Pos] = true;
                    break;
                }
            }
        }
    }
    {
        int i = 0;
        size_t e = Components.length;
        for (; i < e; ++i) {
            if (Components[i] is ··null!(dstring)) {
                Components[i] = "unknown"d;
            }
        }
    }
    if (Environment == EnvironmentType.Android && 开始包含(Components[3], "androideabi"d)) {
        dstring AndroidVersion = (Components[3])["androideabi"d.length .. $];
        Components[3] = (AndroidVersion is ··null!(dstring)) ? "android"d : "android"d ~ AndroidVersion;
    }
    if (Vendor == VendorType.SUSE && Environment == EnvironmentType.GNUEABI) {
        Components[3] = "gnueabihf"d;
    }
    if (OS == OSType.Win32) {
        Components[2] = "windows"d;
        if (Environment == EnvironmentType.UnknownEnvironment) {
            Components[3] = (ObjectFormat == ObjectFormatType.UnknownObjectFormat || ObjectFormat == ObjectFormatType.COFF) ? "msvc"d : .getObjectFormatTypeName(ObjectFormat);
        }
    }
    else if (IsMinGW32) {
        Components[2] = "windows"d;
        Components[3] = "gnu"d;
    }
    else if (IsCygwin) {
        Components[2] = "windows"d;
        Components[3] = "cygnus"d;
    }
    if (IsMinGW32 || IsCygwin || (OS == OSType.Win32 && Environment != EnvironmentType.UnknownEnvironment)) {
        if (ObjectFormat != ObjectFormatType.UnknownObjectFormat && ObjectFormat != ObjectFormatType.COFF) {
            Components[4] = .getObjectFormatTypeName(ObjectFormat);
        }
    }
    return 连接(Components, "-"d);
}
